//
//  ViewController.m
//  预习UICollectionView
//
//  Created by dllo on 16/7/24.
//  Copyright © 2016年 YMJ. All rights reserved.
//

#import "ViewController.h"
#import "CircleLayout.h"
#import "CircleCollectionViewCell.h"
@interface ViewController ()<UICollectionViewDataSource,UICollectionViewDelegate>
@property (nonatomic, strong) UICollectionView *collect;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor brownColor];
    // 流水layout
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
    flowLayout.minimumInteritemSpacing = 10;
    flowLayout.minimumLineSpacing = 20;
    flowLayout.itemSize = CGSizeMake(120, 100);
    
    
    // 圆形layout
    CircleLayout *layout = [[CircleLayout alloc] init];
    self.collect = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, 414, 414) collectionViewLayout:layout];
    _collect.backgroundColor = [UIColor blueColor];
    [self.view addSubview:_collect];
    _collect.delegate = self;
    _collect.dataSource = self;
    flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    [self.collect registerClass:[CircleCollectionViewCell class] forCellWithReuseIdentifier:@"reuse"];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 7;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    CircleCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"reuse" forIndexPath:indexPath];
    cell.imageVIew.image = [UIImage imageNamed:@"69119dcebecf9d1adb90983ba93f150cd55a8eb263dc6-FbeTYI_fw658"];
    cell.backgroundColor = [UIColor blueColor];
    return cell;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
